/**
 * Copyright 2009 Wisdom
 */
package com.wisdom.model.dao;

import java.util.Date;
import java.util.List;

import com.wisdom.model.entities.Category;
import com.wisdom.model.entities.Keyword;
import com.wisdom.model.entities.Post;
import com.wisdom.model.entities.User;

/**
 * Data access object for work with Posts
 * 
 * @author alekseiko
 * @since 1.0
 */
public interface PostDao {

    /**
     * Get all posts in system.
     * 
     * @return {@link Post} list
     */
    List<Post> getPosts();

    /**
     * Get commented or not commented posts
     * 
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPosts(final boolean commented);

    /**
     * Get posts by categories.
     * 
     * @param categories
     *            - {@link Category} list
     * @return {@link Post} list
     */
    List<Post> getPostsByCategories(final List<Category> categories);

    /**
     * Get commented or not commented posts by categories
     * 
     * @param categories
     *            {@link Category} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post}
     */
    List<Post> getPostsByCategories(final List<Category> categories,
	    final boolean commented);

    /**
     * Get all users posts.
     * 
     * @param users
     *            - {@link User} list
     * @return {@link Post} list
     */
    List<Post> getPostsByUsers(final List<User> users);

    /**
     * Get all users commented or not commented posts.
     * 
     * @param users
     *            - {@link User} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByUsers(final List<User> users, final boolean commented);

    /**
     * Get all users posts by categories.
     * 
     * @param users
     *            - {@link User} list
     * @param categories
     *            - {@link Category} list
     * @return {@link Post} list
     */
    List<Post> getPostsByUsers(final List<User> users,
	    final List<Category> categories);

    /**
     * Get all users commented or not commented posts by categories
     * 
     * @param users
     *            - {@link User} list
     * @param categories
     *            - {@link Category} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByUsers(final List<User> users,
	    final List<Category> categories, final boolean commented);

    /**
     * Get posts by keywords
     * 
     * @param keywords
     *            - {@link Keyword} list
     * @return {@link Post} list
     */
    List<Post> getPostsByKeywords(final List<Keyword> keywords);

    /**
     * Get commented or not commented posts by keywords
     * 
     * @param keywords
     *            - {@link Keyword} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByKeywords(final List<Keyword> keywords,
	    final boolean commented);

    /**
     * Get all posts by categories and keywords
     * 
     * @param keywords
     *            - {@link Keyword} list
     * @param categories
     *            - {@link Category} list
     * @return {@link Post} list
     */
    List<Post> getPostsByKeywords(final List<Keyword> keywords,
	    final List<Category> categories);

    /**
     * Get commented or not commented posts by categories and keywords
     * 
     * @param keywords
     *            - {@link Keyword} list
     * @param categories
     *            - {@link Category} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByKeywords(final List<Keyword> keywords,
	    final List<Category> categories, final boolean commented);

    /**
     * Get posts by text fragment
     * 
     * @param fragment
     *            - text fragment
     * @return {@link Post} list
     */
    List<Post> getPostsByFragment(final String fragment);

    /**
     * Get commented or not commented posts by text fragment
     * 
     * @param fragment
     *            - text fragment
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByFragment(final String fragment, final boolean commented);

    /**
     * Get posts by text fragment and categories
     * 
     * @param fragment
     *            - text fragment
     * @param categories
     *            {@link Category} list
     * @return {@link Post} list
     */
    List<Post> getPostsByFragment(final String fragment,
	    final List<Category> categories);

    /**
     * Get commented or not commented posts by categories and text fragment
     * 
     * @param fragment
     *            - text fragment
     * @param categories
     *            - {@link Category} list
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByFragment(final String fragment,
	    final List<Category> categories, final boolean commented);

    /**
     * Get posts posted in "posted date".
     * 
     * @param posted
     *            - date when post was posted
     * @return {@link Post} list
     */
    List<Post> getPostsByPostedDate(final Date posted);

    /**
     * Get commented or not commented posts posted in "posted date"
     * 
     * @param posted
     *            - date when post was posted
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByPostedDate(final Date posted, final boolean commented);

    /**
     * Get posts posted in "posted date" by categories
     * 
     * @param posted
     *            - date when post was posted
     * @param categories
     *            - {@link Category} list
     * @return {@link Post} list
     */
    List<Post> getPostsByPostedDate(final Date posted,
	    final List<Category> categories);

    /**
     * Get commented or not commented posts posted in "posted date" by
     * categories
     * 
     * @param posted
     *            - date when post was posted
     * @param categories
     *            - {@link Category} list
     * 
     * @param commented
     *            - if true then get commented posts otherwise get not commented
     *            posts
     * @return {@link Post} list
     */
    List<Post> getPostsByPostedDate(final Date posted,
	    final List<Category> categories, final boolean commented);

    /**
     * Get post by id.
     * 
     * @param id
     *            - unique post identifier
     * @return {@link Post} list
     */
    Post getPost(final long id);

    /**
     * Remove post from system
     * 
     * @param post
     *            - {@link Post}
     */
    void remove(Post post);

    /**
     * Save post in system
     * 
     * @param post
     *            - {@link Post}
     */
    void save(Post post);
}
